package com.tgb.manager;  
  
import java.util.List;  

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.tgb.dao.UserDao;  
import com.tgb.entity.User;

@Service//声明是业务层的组件
@Transactional//对类中所有方法采用默认的事务管理 
public class UserManagerImpl implements UserManager {  
	//@Resource(name="userDao")
	@Autowired 
    private UserDao userDao;  
     
	@Transactional(propagation=Propagation.REQUIRED)
    public void setUserDao(UserDao userDao) {  
        this.userDao = userDao;  
    }  
  
    @Override  
    public User getUser(String id) {  
        return userDao.getUser(id);  
    }  
  
    @Override  
    public List<User> getAllUser() {  
        return userDao.getAllUser();  
    }  
  
    @Override  
    public boolean delUser(String id) {  
          
        return userDao.delUser(id);  
    }  
  
    @Override  
    public boolean updateUser(User user) {  
        return userDao.updateUser(user);  
    }

	@Override
	public List<User> getAllUser(String teacherId) {
		return userDao.getAllUser(teacherId);
	}

	@Override
	public void addUser(String teacherId, User user) {
		userDao.addUser(teacherId,user); 
		
	}  
  
}  